<!DOCTYPE html>
<html lang="zh">
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <title>积分系统CMS管理后台->用户登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link rel="stylesheet" href="css/bootstrap.min.css">

    <!--[if lt IE 9]>
    <script src="lib/html5shiv.min.js"></script>
    <script src="lib/respond.min.js"></script>
    <![endif]-->
</head>
<body>



<div class="container">
    <!-- body start-->
    <div class="center_container" style="padding-top: 60px;">
        <form id="login_form" class="form-horizontal" method="post">
            <fieldset class="login">
                <legend  class="form_legend">
                    <h2>CMS后台管理&nbsp;<small>登录</small></h2>
                </legend>

                <div class="control-group">
                    <label>用户名</label>
                    <div class="login-controls">
                        <input type="text" id="user_name" name="user_name" size="30"/>
                    </div>
                </div>
                <div class="control-group">
                    <label>密码</label>
                    <div class="login-controls">
                        <input type="password" id="password" name="password" size="30"/>
                    </div>
                </div>
                <div class="control-group">
                    <span class="control-label">
                    </span>
                    <div class="login-controls">
                        <input type="hidden" name="ticket" value="gfzq&^*%gfzq"/>
                        <input type="hidden" name="login_type" value="oa" />
                        &nbsp; &nbsp;
                    </div>
                </div>
                <div class="control-group">
                    <button type="button" id="btn_submit" class="btn btn-primary" onclick="doLogin()">
                        &nbsp;登&nbsp;录&nbsp;
                    </button>
                </div>
                <div class="control-group">
                    <span class="control-label">
                    </span>
                    <div class="login-controls">
                        &nbsp; &nbsp;
                    </div>
                </div>
                <div id="error_div" class="control-group alert alert-danger alert-dismissable" style="width:170px;display: none">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <strong id="error_msg"></strong>
                </div>
            </fieldset>
        </form>
    </div>
    <!-- body end -->
</div>


<script src="lib/jquery-1.10.2.min.js"></script>
<script src="lib/bootstrap.min.js"></script>
<script type="text/javascript">
    function doLogin(){
        $("#error_div").hide();
        if($("#user_name").val()=="") {
            $("#user_name").focus();
            $("#error_div").show();
            $("#error_msg").html("请输入用户名！");
        }else if($("#password").val()=="") {
            $("#password").focus();
            $("#error_div").show();
            $("#error_msg").html("请输入密码！");
        }else {
            var params = {};
            params.user_password = $("#password").val();
            params.user_name = $("#user_name").val();
            $.post("/admin_user/login",params,function(resp){
                window.location.href = "/admin/index.html";
            }).error(function(err){
                $("#password").focus();
                $("#error_div").show();
                if(err.responseJSON && err.responseJSON.error){
                    $("#error_msg").html(err.responseJSON.error);
                }else{
                    $("#error_msg").html("系统发生异常，登陆失败!");
                }
                
            })
        }
    }
</script>
</body>
</html>